package com.etc.config;

import com.etc.interceptor.LoginHandlerInceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig  implements WebMvcConfigurer {

    //注入一个LoginHandlerInceptor
    @Autowired
    private LoginHandlerInceptor loginHandlerInceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //除了url请求地址 /login以外，都被拦截
//        registry.addInterceptor(loginHandlerInceptor).addPathPatterns("/**").excludePathPatterns("/user/login","/user/add");
    }
}
